
# 创建测试文件
# echo "hello " > test; cp test tets_copy1;cp test tets_copy2;
# echo "next" > other;

ls -LS --time-style=long-ios | awk 'BEGIN {
	getline; getline;
	name1=$8;size=$5;
}
{
	name2=$8;
	if(size==$5){
		"md5sum"name1|getline; csum1=$1;
		"md5sum"name2|getline; csum2=$1;
		if(csum1=csum2){
			print name1; print name2;
		}

	};
	size=$5; name1=name2;
}' | sort -u > duplicate_files
cat duplicate_files | xargs -I {} md5sum {} | sort | uniq -w 32 | awk '{
	print"^"$2"$"
}' | sort -u >duplicate_files_sample
echo removing...

comm duplicate_files duplicate_files_sample -2 -3 | xargs rm

echo removed duplicate files successfully
